package com.xiaohu.demo.dao.address;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import com.xiaohu.demo.dao.common.CommonDao;

@Repository
public class AddressDao {
	
	@Resource
	private JdbcTemplate jdbcTemplate;
	
	public List<Map<String,Object>> getCity(String level,String parentId){
		String sql = " select * from t_address where level = ? and parentId = ? order by code asc ";
		return jdbcTemplate.queryForList(sql, level , parentId);
	}
	
	public List<Map<String,Object>> getProvince(){
		String sql = " select code id,name label from t_address where level = '1' and parentId = '0' order by code asc ";
		return jdbcTemplate.queryForList(sql);
	}
}
